package com.example.litehdfs.controller;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.litehdfs.config.ResponseMsg;
import com.example.litehdfs.service.LiteHdfsService;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/liteHdfs")
@Slf4j
public class LiteHdfsController {

	@Autowired
    private LiteHdfsService liteHdfsService;
	

	@PostMapping("/test")
    public ResponseMsg<Void> test() {
        return ResponseMsg.ofSuccess();
    }
	
	/***
	 * 下载
	 * @param request
	 * @param fileName
	 */
	@GetMapping("/file/{fileName}")
	public void downloadFile(HttpServletResponse resp,@PathVariable String fileName) {
	    liteHdfsService.downloadFile(resp,fileName);
	}
	
	
	
}
